package LuoGu.入门.压缩技术2;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String [] temp = new String [20];
        temp[0] = br.readLine();
        int n = temp[0].length();
        for(int i=1;i<n;i++){
            temp[i] = br.readLine();
        }
        System.out.print(n+" ");
        String temp1 = "";
        for(int i=0;i<n;i++){
            temp1+=temp[i];
        }
        char check = '0';
        int ans = 0;
        for(int i=0;i<n*n;i++){
            if(temp1.charAt(i)==check) ans++;
            else{
                System.out.print(ans+" ");
                ans = 1;
                if(check=='1') check = '0';
                else check = '1';
            }
        }
        System.out.print(ans);
    }
}
